package flc.ast.adapter;

import android.graphics.Color;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.CalendarBean;
import flc.ast.bean.RecordBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class CalendarAdapter extends StkProviderMultiAdapter<CalendarBean> {

    public CalendarAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(82));
        addItemProvider(new CalendarProvider());
    }

    private class CalendarProvider extends BaseItemProvider<CalendarBean> {

        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_kind;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, CalendarBean bean) {
            baseViewHolder.setText(R.id.tvKindItemName, bean.getWeek());
            if (bean.isSelected()) {
                TextView textView = baseViewHolder.getView(R.id.tvKindItemName);
                textView.setTextColor(Color.parseColor("#0A61E8"));
                textView.setTextSize(20);
                baseViewHolder.getView(R.id.ivKindItemSel).setVisibility(View.VISIBLE);
            } else {
                TextView textView = baseViewHolder.getView(R.id.tvKindItemName);
                textView.setTextColor(Color.parseColor("#616F8C"));
                textView.setTextSize(16);
                baseViewHolder.getView(R.id.ivKindItemSel).setVisibility(View.GONE);
            }
        }

    }

}
